﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace SongsExtractor
{
    class SongsExtractor
    {
        static List<string> ExtractSongTitles(string xmlName)
        {
            List<string> allSongs = new List<string>();
            XmlReader reader = XmlReader.Create(xmlName);
            using (reader)
            {
                while (reader.Read())
                {
                    if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "title"))
                    {
                        allSongs.Add(reader.ReadElementString());
                    }
                }
            }
            return allSongs;
        }

        static void Main()
        {
            const string SourceXML = @"..\..\..\catalog.xml";

            List<string> allSongs = ExtractSongTitles(SourceXML);

            foreach (string song in allSongs)
            {
                Console.WriteLine(song);
            }
        }
    }
}
